#pragma once
#include "afxcmn.h"


// CChatServerDlg dialog
class CChatServerDoc;
class NetworkIDManager;
class CChatRoom;

class CChatServerDlg : public CDialog
{
	CChatServerDoc*		m_pChatServerDoc;
	CLogView*			m_pLogView;
	NetworkIDManager*	m_pServerNetworkIDManager;
	
	typedef std::map<NetworkID, CChatRoom*> CHATROOM_CONTAINER;
	CHATROOM_CONTAINER	m_chatRoomContainer;

	CIPAddressCtrl m_ipAddress;
	DWORD m_port;
	CListCtrl m_lobby;

	DECLARE_DYNAMIC(CChatServerDlg)	

public:
	CChatServerDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CChatServerDlg();

// Dialog Data
	enum { IDD = IDD_DIALOG_CHATSERVER };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	CChatRoom*	createChatRoom(const TCHAR* pName);
	bool		joinChatRoom(NetworkID& roomID, const RakNetGUID& userGuid);
	void		exitChatRoom(const RakNetGUID& userGuid);
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void	OnBnClickedButtonListen();
	
	virtual BOOL	OnInitDialog();
	void			SetChatServerDoc(CChatServerDoc& chatServerDoc);
	void			SetLogView(CLogView&	logView);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
};
